Repository navigation
fix(portfolio-import): 数量/成本尾随百分号改为需人工确认 - #413
Merged
Merged
Conversation
helsome
previously requested changes
Nov 12, 2026
helsome
left a comment
Owner
There was a problem hiding this comment.
这里的 % 不能在持仓数量/成本字段中无条件视为装饰字符。100%、12.5% 也可能是比例或错误列映射;直接按 100、12.5 入账,会把原本应提示用户修正的输入静默转成真实持仓,风险高于拒绝解析。请提供明确的券商导出样本与字段契约,或将这类单元格标记为需要人工确认;在此之前不建议合并。
100% 与 12.5% 不再按数字入账。这类单元格记入 issues 并降为需复核,避免把比例或错列静默写成真实持仓。 Co-authored-by: wannT-1 <[email protected]>
Contributor
Author
|
感谢 review。已按你的建议改了:在没有经过核对的券商导出样本之前,不再把数量/成本里的尾随
测试: Commit:55379a17 |
helsome
dismissed
their stale review
November 12, 2026 07:04
作者已在 55379a1 修复先前阻断:百分比数量/成本不再按数字静默入账,而是保留复核警告;相关解析、draft 和持久化回归已补齐。原 REQUEST_CHANGES 不再适用。
wannT-1
added a commit
to wannT-1/folio
that referenced
this pull request
Nov 17, 2026
Resolve conflicts from helsome#413 (trailing-percent confirmation) and helsome#414 (semicolon CSV) landing upstream: - toFiniteNumber now runs the branch's normalisation pipeline (stripInvisible -> foldNumericWidth -> takeAccountingSign -> stripCurrencyAffixes) and feeds the result into upstream's stripNumericDecorations, so the trailing-% semantics added by helsome#413 are preserved instead of reverting them. - Symbol length is 1-6 upstream already, so the branch's 1-6 change and its docs were dropped rather than re-applied. - Tests: kept this branch's currency / accounting-negative / fullwidth / zero-width cases and upstream's percent-confirmation cases. packages/shared/src/portfolio-import: 125 pass, 0 fail.
This was referenced Nov 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动说明
What
按 review 意见调整:
toFiniteNumber在去掉千分位、$和空白之后,若剩余文本是纯数字加一个尾随%(如100%、12.5%),不再静默解析为 100 / 12.5 入账。数量、成本留空,该行走现有复核路径:issues记为Quantity "100%" needs confirmation或Cost price "12.5%" needs confirmationconfidence为0.6(需要复核);若 symbol 已模糊则为0.3draft.warnings仍会标记该行需要 review不新增 UI。
1,000、$180.50、1,234.56等原有解析不变。100%%、10%5仍视为非法数值。Why
数量/成本里的
%不能无条件视为装饰字符。100%、12.5%也可能是比例或错误列映射;静默按 100、12.5 入账的风险,高于拒绝解析并交给用户确认。目前没有经过核对的券商导出样本与字段契约,因此走「需要人工确认」路径。不改表头映射,也不处理货币前缀、会计括号、全角数字或零宽字符(#356–#360 的范围)。
关联 Issue
Closes #409
测试报告(正式审核前必填)
环境
实际执行命令与结果
已知失败 / Baseline(如有)
无失败。
UI 截图(仅可见 UI 变化时必填)
Scope / 后续
只处理数量/成本上「纯数字 + 一个尾随
%」,改为需人工确认,不静默入账。不把百分号列自动当成权重。